package operation;

import book.Book;
import book.BookList;

import java.util.Scanner;

public class AddOperation implements IOperation{
    @Override
    public void work(BookList bookList) {
        System.out.println("请输入图书名：");
        Scanner scanner = new Scanner(System.in);
        String name = scanner.nextLine();
        System.out.println("请输入作者名：");
        String author = scanner.nextLine();
        System.out.println("请输入图书类型：");
        String type = scanner.nextLine();
        System.out.println("请输入价格：");
        float price = scanner.nextFloat();
        Book book = new Book(name,author,type,price);
        bookList.setBook(bookList.getUsedSize(), book);
        System.out.println("新增图书成功");
    }
}
